import 'package:flutter/material.dart';

void main() =>runApp(MyApp(
));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: "Row Widgth demo",
        home: FirstPage()
    );
  }
}

class FirstPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title:new Text("第一个页面  找小姐姐要电话")),
      body: Center(
        child: RouterButton(),
      ),
    );
  }
}

class RouterButton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return RaisedButton(
      onPressed: (){
        _navigateToXiaoJieJie(context);
        print("点击了");

      },child: Text("去找小姐姐姐"),
    );
  }
  _navigateToXiaoJieJie(BuildContext context) async{
    final result= await Navigator.push(
        context,
        MaterialPageRoute(builder: (context)=>XiaoJieJie()));

    Scaffold.of(context).showSnackBar(SnackBar(content: Text("$result")));
  }
}

//子页面
class XiaoJieJie extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("我是   小姐姐页面"),),
      body: Center(
        child: Column(
          children: <Widget>[
            RaisedButton(
              child: Text("大馋鬼小姐姐诶"),
              onPressed: (){
                Navigator.pop(context,"大馋鬼");
              },
            ),
            RaisedButton(
              child: Text("吃货小姐姐诶"),
              onPressed: (){
                Navigator.pop(context,"吃货");
              },
            )
          ],
        ),
      ),
    );
  }
}

